<?php

namespace App\Console\Commands;

use App\Models\Activity\Activity;
use App\Models\Activity\Category;
use App\Models\Activity\Join;
use App\Models\Common\City;
use App\Models\Common\Country;
use App\Models\Common\File;
use App\Models\Common\Log;
use App\Models\Member\Follow;
use App\Models\Member\FreezeMoneyLog;
use App\Models\Member\Friend;
use App\Models\Member\Member;
use App\Models\Old\Event;
use App\Models\Old\Image;
use App\Models\Old\Region;
use App\Models\Order\Order;
use App\Models\Posts\Posts;
use App\Models\School\School;
use App\Services\Com\ExportService;
use App\Services\Com\PinYinService;
use App\Services\Com\UtilService;

use App\Services\Group\GroupService;
use App\Services\Member\FreezeMoneyService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Maatwebsite\Excel\Facades\Excel;
use OSS\OssClient;
use Overtrue\Pinyin\Pinyin;

/**
 *  php artisan test
 */
class Work extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'work';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    public function handle(){
        $year = date('Y-01-01');
        $memberExitIds = \App\Models\Work::where('year', $year)->pluck('member_id');
        $members = Member::whereNotIn('id', $memberExitIds)->get();
        foreach ($members as $member){
            \App\Models\Work::create([
                'member_id' => $member->id,
                'org_id' => $member->org_id,
                'year' => $year,
                'target' => 10,
            ]);
        }
    }





}
